<template>
  <div>
    <div class="playlist" v-if="houduanarr.length !== 0">
      <div class="title">
        <div class="left">
          <i class="iconfont icon-fanhui" @click="huoqu()"></i>
          <span>{{ title | sub }}</span>
        </div>
        <div class="right">
          <div>
            <i class="iconfont icon-bofang"></i>
            <span>播放</span>
          </div>
        </div>
      </div>
      <div class="wrap">
        <List
          class="content"
          v-for="v in houduanarr"
          :key="v.title"
          :song="v.songs"
        />
      </div>
    </div>
    <div class="playlist" v-else>
      <div class="title">
        <div class="left">
          <i class="iconfont icon-fanhui"></i>
          <span>温柔岁月的华语情怀</span>
        </div>
        <div class="right">
          <div>
            <i class="iconfont icon-bofang"></i>
            <span>播放</span>
          </div>
        </div>
      </div>
      <div class="wrap">
        <List
          class="content"
          v-for="(v, i) in moniarr"
          :key="i + 10086"
          :arr="{ ...v.resources }"
        />
      </div>
    </div>
  </div>
</template>
<script>
import List from "../components/list.component.vue";
import { getlink } from "@/api/getlink";
export default {
  data() {
    return {
      houduanarr: [],
      moniarr: [],
      title: "",
      button: "",
    };
  },
  created() {
    getlink("/wjmz/load/OneSongList").then((res) => {
      this.title = res.data.listName;
      this.houduanarr = res.data.lists;
    });
    getlink("/xpf/home").then((ok) => {
      this.moniarr = ok.data.data.blocks[4].creatives;
    });
  },
  methods: {
    huoqu() {
      getlink("/wjmz/load/OneSongList").then((res) => {
        this.title = res.data.listName;
        this.houduanarr = res.data.lists;
      });
    },
  },
  filters: {
    sub(val) {
      return val.substr(0, 13) + "...";
    },
  },
  components: {
    List,
  },
};
</script>

<style lang="less" scoped>
.playlist {
  height: 4.75rem;
  background-color: #fff;
  border-radius: 0.16rem;
  margin-bottom: 0.19rem;
  padding: 0.4rem 0 0.35rem 0.3rem;
  .title {
    display: flex;
    justify-content: space-between;
    padding-right: 0.3rem;
    margin-bottom: 0.11rem;
    .left {
      i {
        font-size: 0.33rem;
        vertical-align: middle;
        margin-right: 0.05rem;
      }
      span {
        vertical-align: middle;
        font-size: 0.31rem;
      }
    }
    .right {
      width: 1.13rem;
      height: 0.46rem;
      border: 0.01rem solid;
      border-radius: 0.2rem;
      display: flex;
      justify-content: center;
      align-items: center;
      i {
        font-size: 0.18rem;
        vertical-align: middle;
      }
      span {
        vertical-align: middle;
        font-size: 0.23rem;
      }
    }
  }
  .wrap {
    display: flex;
    overflow: auto;
    .content {
    }
  }
}
/*隐藏滚动条*/
::-webkit-scrollbar {
  display: none;
}
</style>